<?php
function user_actions_dingding()
{

    $url = 'https://oapi.dingtalk.com/robot/send?access_token=b4091e41ca225b5f8d89efd91d2f42a5aad2bb4f2b639c508d34c43cca119af4';

    $parameters = array(
        'msgtype' => "markdown",
        'markdown' => [
            'title' => "系统通知",
            'text' => "## 工单需要申请上道提醒   
![screenshot](https://cdn.fix-it.com.cn/uploads/image/20210302/11824/1614677025245_421448.jpg) 
> 郑州站 \n\n
> 线路监控花屏，疑似摄像机故障  \n\n
> 需要上道作业  \n\n
> 服务人员：张三 李四 王五 \n\n
> 申请时间：2021年4月1日 22:51 \n\n
#### 2021年4月2日 12点04分发布  \n\n   @13693716131 @13525520709"
        ],
        'at' => [
            'atMobiles' => [
                '13693716131',
                '13525520709'
            ]
        ]

    );

    $parameters = json_encode($parameters, JSON_UNESCAPED_UNICODE);

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);

    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
    curl_setopt($curl, CURLOPT_HEADER, FALSE);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $parameters);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        "Content-Type:application/json"
    ));
    $response = curl_exec($curl);
    if (curl_error($curl)) {
        $error_msg = curl_error($curl);
        $error_no = curl_errno($curl);
        curl_close($curl);
        throw new \Exception($error_msg, $error_no);
    }
    curl_close($curl);
    return $response;
}

$res4 = user_actions_dingding();
var_dump($res4);
